package com.ycfmedical.bed.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ycfmedical.bed.R;
import com.ycfmedical.bed.local.entity.BillRecords;

import butterknife.BindView;
import cn.droidlover.xdroidmvp.base.SimpleRecAdapter;
import cn.droidlover.xdroidmvp.kit.KnifeKit;

/**
 * Created by yf on 2017-05-2.
 * 住院病例
 */

public class HisMedicalRecordsAdapter extends SimpleRecAdapter<BillRecords, HisMedicalRecordsAdapter.ViewHolder> {

    @BindView(R.id.excel_liner)
    LinearLayout excelLiner;
    private int billCheckAdapterType;//

    /**
     * */
    public HisMedicalRecordsAdapter(Context context) {
        super(context);

    }

    @Override
    public ViewHolder newViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_hismedicalrecords;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {

        BillRecords billCheck = data.get(position);

        if (position == 0) {
            holder.ExcelC1.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC2.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC3.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC4.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC5.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC6.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC7.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC8.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC9.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC10.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));
            holder.ExcelC11.setBackgroundColor(context.getResources().getColor(R.color.hisbg_blue));

            holder.ExcelC1.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC2.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC3.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC4.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC5.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC6.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC7.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC8.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC9.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC10.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));
            holder.ExcelC11.setTextColor(context.getResources().getColor(R.color.hisbg_TextWhite));

        } else {

            holder.ExcelC1.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC2.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC3.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC4.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC5.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC6.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC7.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC8.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC9.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC10.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));
            holder.ExcelC11.setTextColor(context.getResources().getColor(R.color.hisbg_TextGray));

        }

        holder.ExcelC1.setText(billCheck.getExcelC1());
        holder.ExcelC2.setText(billCheck.getExcelC2());
        holder.ExcelC3.setText(billCheck.getExcelC3());
        holder.ExcelC4.setText(billCheck.getExcelC4());
        holder.ExcelC5.setText(billCheck.getExcelC5());
        holder.ExcelC6.setText(billCheck.getExcelC6());
        holder.ExcelC7.setText(billCheck.getExcelC7());
        holder.ExcelC8.setText(billCheck.getExcelC8());
        holder.ExcelC9.setText(billCheck.getExcelC9());
        holder.ExcelC10.setText(billCheck.getExcelC10());
        holder.ExcelC11.setText(billCheck.getExcelC11());

    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.ExcelC1)
        TextView ExcelC1;
        @BindView(R.id.ExcelC2)
        TextView ExcelC2;
        @BindView(R.id.ExcelC3)
        TextView ExcelC3;
        @BindView(R.id.ExcelC4)
        TextView ExcelC4;
        @BindView(R.id.ExcelC5)
        TextView ExcelC5;
        @BindView(R.id.ExcelC6)
        TextView ExcelC6;
        @BindView(R.id.ExcelC7)
        TextView ExcelC7;
        @BindView(R.id.ExcelC8)
        TextView ExcelC8;
        @BindView(R.id.ExcelC9)
        TextView ExcelC9;
        @BindView(R.id.ExcelC10)
        TextView ExcelC10;
        @BindView(R.id.ExcelC11)
        TextView ExcelC11;


        public ViewHolder(View itemView) {
            super(itemView);
            KnifeKit.bind(this, itemView);
        }
    }
}
